#ifndef LR0_H_
#define LR0_H_
/* lr0.h - interface to LR(0) code.
 */

#include <limits.h>
#if UINT_MAX < (0xFFFFFFFF)
    typedef int    TITEM;
#else
    typedef long   TITEM;
#endif

#include "symtab.h"

typedef struct  TItemSet
    {
    int         Count;
    TITEM*      Items;
    }           TItemSet;

typedef struct  TTransition
    {
    TSymbol*    Symbol;
    int         NextState;
    }           TTransition;

typedef struct  TTransitions
    {
    int         Count;
    TTransition*Transitions;
    }           TTransitions;

typedef struct  TState
    {
    int             Final;
    int             Accepting;
    int             Inbound;
    TItemSet        ItemSet;
    TTransitions    Transitions;
    }           TState;

typedef struct  TStates
    {
    int         Start;              /* index in States of start state */
    int         Count;
    TState**    States;
    SYMBOLS     OpTokens;           /* list of operator tokens used by state machine    */
    int         TokenClassCount;
    SYMBOLS*    TokenClasses;
    }           TStates;

#if 0
int     ItemAdd(TItemSet* Set, int Rule, int Position);
int     ItemSetCmp(TItemSet* A, TItemSet* B);

TStates*    StatesNew(void);
TState*     StateNew(void);
#endif

void    ComputeAllLR0(void);

#endif  /* LR0_H_ */
